import QtQuick 2.12

import QtQuick.Controls 2.7
import QtQuick.Layouts 1.12

Page {
    id: page4
    visible: false


    header:Rectangle {
        height: 64
        color: "green"
        RowLayout {
            anchors.fill: parent
            Button {
                id: retbtn
                width: 60
                height: 48
                background: Item {

                }
                onClicked:  {
                    //page2.StackView.view.pop() //not work
                    //console.log("stackView: " + stackView)
                    //console.log("page2.StackView.view: " + page2.StackView.view)
                    stackView.pop()
                }
                icon {
                    source: "../images/icon_back.png"
                    color: "white"
                    height: 36
                    width: 36
                }
            }

            Text {
                text: qsTr("系统设置")
                font.pixelSize: 22
            }
            Item {
                Layout.fillWidth: true
            }
            CurrentDateTime {
                Layout.rightMargin: 10
            }


        }
    }

    ColumnLayout {
        width: parent.width/5*3
        height: 400
        anchors.centerIn: parent
        RowLayout {

            Layout.fillWidth: true

            Text {
                text: qsTr("身份验证：")
                width: 100
                horizontalAlignment: Text.AlignRight
            }
            Item {
                Layout.fillWidth: true

            }
            Switch {
                id: swith
                //text: qsTr("Switch")
                width: 64
                indicator: Rectangle {
                    implicitWidth: 48
                    implicitHeight: 26
                    x: swith.leftPadding
                    y: (parent.height- height) / 2
                    radius: 13
                    color: swith.checked ? "#17a81a" : "#ffffff"
                    border.color: swith.checked ? "#17a81a" : "#cccccc"

                    Rectangle {
                        x: swith.checked ? parent.width - width : 0
                        width: 26
                        height: 26
                        radius: 13
                        color: swith.down ? "#cccccc" : "#ffffff"
                        border.color: swith.checked ? (swith.down ? "#17a81a" : "#21be2b") : "#999999"
                    }
                }


            }
        }
        RowLayout {
            Layout.fillWidth: true
            Text {
                text: qsTr("库存比例：")
                width: 100
                horizontalAlignment: Text.AlignRight
            }
            Text {
                text: "0"
            }
            Slider {
                id: control
                Layout.fillWidth: true
                value: 50
                stepSize: 1
                from: 0
                to: 100
                background: Rectangle {
                    x: control.leftPadding
                    y: control.topPadding + control.availableHeight / 2 - height / 2
                    implicitWidth: 200
                    implicitHeight: 4
                    width: control.availableWidth
                    height: implicitHeight
                    radius: 2
                    color: "#bdbebf"

                    Rectangle {
                        width: control.visualPosition * parent.width
                        height: parent.height
                        color: "#21be2b"
                        radius: 2
                    }
                }
                handle:
                    Rectangle {
                    x:  control.leftPadding + control.visualPosition * (control.availableWidth - width)
                    y: control.topPadding + (control.availableHeight  )/ 2 -  height - 10
                    height: 32
                    width: 64
                    implicitHeight: 64
                    Layout.alignment: Qt.AlignTop
                    color: "grey"
                    Text {
                        text: control.value + "%"
                        anchors.centerIn: parent
                    }

                }


            }
            Text {
                text: "100"
            }
        }

    }

}
